<!DOCTYPE html>
<html>
<head>
	<title></title>
	<meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
	<link rel="stylesheet" type="text/css" href="/static/css/hw-admin.css">
	<link rel="stylesheet" href="/static/css/lb.css"> 
    <style>
        #edui1_iframeholder,#edui1 {
            width: 853px !important;
        }
        #account-table input {
            width: 100%;
            height: 100%;
            border: none;
        }
        #allmap,#container {
            width: 500px;
            height: 250px;
        }
    </style>
   	<!--[if lt IE 9]>
    　 <script src="https://cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
       <script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.js"></script>
    <![endif]-->
    <!-- <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=WloYy83KwAZE3EVH3n4qBQ2o4SLEImfX"></script> -->
    <script charset="utf-8" src="https://map.qq.com/api/js?v=2.exp&key=MEVBZ-TJGRJ-LF7F2-FUSW3-B6EYF-4IBDI"></script>
</head>
<body>

    <div class="hw-iframe">
        
        <!-- 顶部标题 -->
        <div class="hw-header-wrapper">
            <div class="hw-header">
                <div class="hw-header__item--left">
                    编辑酒店
                </div> 
            </div>
        </div>
        <form action="" method="POST" id="main-form">
        <div class="hw-group">
            <div class="group-title">基本信息</div>

            <div class="group-info">
                <div class="group-item">
                    <div class="hw-input-label">
                        <div class="name">酒店编码<span>*</span></div>
                        <div class="form-control">
                            <input class="hw-input" type="text" style="background: #eee;color: #000;outline: none;" name="hotel_code" value="<?=$find['hotel_code'] ?>" required disabled>
                        </div>
                    </div>
                    <div class="hw-input-label">
                        <div class="name">酒店名称<span>*</span></div>
                        <div class="form-control">
                            <input class="hw-input" type="text" name="name" value="<?=$find['name'] ?>" required>
                        </div>
                    </div>
                </div>

                      
                <div class="group-item">
                    <div class="hw-input-label">
                        <div class="name">联系人</div>
                        <div class="form-control">
                            <input class="hw-input" type="text" name="people" value="<?=$find['people'] ?>" >
                        </div>
                    </div>
                    <div class="hw-input-label">
                        <div class="name">联系电话</div>
                        <div class="form-control">
                            <input class="hw-input" iscontact="iscontact" type="text" name="phone" value="<?=$find['phone'] ?>" >
                        </div>
                    </div>
                </div>
                <div class="group-item">                    
                    <div class="hw-input-label">
                        <div class="name">酒店地址</div>
                        <div class="form-control" style="width: 360px;">
                            <select id="province" class="hw-input smaller-size" name="province"></select>
                            <select id="city" class="hw-input smaller-size" name="city"></select>
                            <select id="area" class="hw-input smaller-size" name="area"></select>
                        </div>
                    </div>
                    <div class="hw-input-label">
                        <div class="form-control">
                            <input class="hw-input address_detail" type="text" name="address" value="<?=$find['address'] ?>" required>
                        </div>
                    </div>
                    <div style="min-width: 83px;cursor: pointer;" onclick="searchByStationName()" class="hw-btn--normal map-btn">
                        地图定位
                    </div>
                </div>
                <div class="group-item">                    
                    <div class="hw-input-label">
                        <div class="name"></div>
                        <div class="form-control" id="allmap">
                            
                        </div>
                    </div>
                </div>
                <div style="display: none;" class="group-item">
                    <div class="hw-input-label">
                        <div class="name">酒店经度</div>
                        <div class="form-control">
                            <input class="hw-input" id="lng" type="text" name="long" value="<?=$find['long'] ?>">
                        </div>
                    </div>
                    <div class="hw-input-label">
                        <div class="name">酒店维度</div>
                        <div class="form-control">
                            <input class="hw-input" id="lat" type="number" name="lat" value="<?=$find['lat'] ?>">
                        </div>
                    </div>
                </div>
                <div class="group-item">
                    <div class="hw-input-label">
                        <div class="name">酒店星级</div>
                        <div class="form-control">
                            <input class="hw-input" type="text" name="star_level" value="<?=$find['star_level'] ?>">
                        </div>
                    </div>
                    <div class="hw-input-label">
                        <div class="name">房间数量</div>
                        <div class="form-control">
                            <input class="hw-input" type="number" name="room_num" value="<?=$find['room_num'] ?>">
                        </div>
                    </div>
                </div>
                <div class="group-item">
                    <div class="hw-input-label">
                        <div class="name">房间单价</div>
                        <div class="form-control">
                            <label class="hw-select">
                                <input class="hw-input" name="room_price" type="text" value="<?=$find['room_price'] ?>" readonly="" unselectable="on">
                                <div class="select-options">
                                    <div class="option <?=$find['room_price'] == '600~800' ? 'selected' : '' ?>" data-value="600~800"><span>600~800</span><i class="iconfont">&#xe649;</i></div>
                                    <div class="option <?=$find['room_price'] == '801~1000' ? 'selected' : '' ?>" data-value="801~1000"><span>801~1000</span><i class="iconfont">&#xe649;</i></div>
                                    <div class="option <?=$find['room_price'] == '1001~1500' ? 'selected' : '' ?>" data-value="1001~1500"><span>1001~1500</span><i class="iconfont">&#xe649;</i></div>
                                    <div class="option <?=$find['room_price'] == '1501~2000' ? 'selected' : '' ?>" data-value="1501~2000"><span>1501~2000</span><i class="iconfont">&#xe649;</i></div>
                                    <div class="option <?=$find['room_price'] == '2000以上' ? 'selected' : '' ?>" data-value="2000以上"><span>2000以上</span><i class="iconfont">&#xe649;</i></div>
                                </div>
                            <div class="show-option"><?=$find['room_price'] ?></div><i class="iconfont"></i></label>
                        </div>
                    </div>
                </div>
                <div class="group-item">
                    <div class="hw-input-label">
                        <div class="name">酒店介绍</div>
                        <div class="form-control">
                            <script id="editor-container" name="info" required type="text/plain"><?=$find['info'] ?></script>
                        </div>
                    </div>
                </div>
            </div>
            
            <?php if (!empty($find['kiosks'])): ?>
                <div class="group-title">酒店机器信息</div>
                <div class="main-table-wrap" style="margin-top: 20px;">
                    <table cellspacing="0" cellpadding="0" border="0">  
                        <colgroup>
                            <col class="col-3">
                            <col class="col-8">
                            <col class="col-7">
                        </colgroup>
                        <thead>
                            <tr>
                                <th>序号</th>
                                <th>机器码</th>
                                <th>部署时间</th>
                            </tr>
                        </thead>
                        
                        <tbody>
                            <?php foreach ($find['kiosks'] as $key => $value): ?>
                                <tr>
                                    <td><?=$key+1 ?></td>
                                    <td><?=$value['id'] ?></td>
                                    <td><?=$value['createdTime'] ?></td>
                                </tr>
                            <?php endforeach ?>
                        </tbody>
                    </table>
                </div>
            <?php endif ?>

            <div class="group-title">账号信息</div>
            <div class="main-table-wrap account-table" id="account-table" style="margin-top: 20px;">
                <table cellspacing="0" cellpadding="0" border="0">  
                    <colgroup>
                        <col class="col-3">
                        <col class="col-8">
                        <col class="col-3">
                        <col class="col-3">
                        <col class="col-7">
                    </colgroup>
                    <thead>
                        <tr>
                            <th>姓名</th>
                            <th>账号</th>
                            <th>密码</th>
                            <th>账号状态</th>
                            <th class="blue-color"><span class="add-account" style="cursor: pointer;">添加账号</span></th>
                        </tr>
                    </thead>
                    
                    <tbody>
                        <?php foreach ($account as $key => $value): ?>
                            <tr>
                                <td><?=$value['name'] ?></td>
                                <td><?=$value['account'] ?></td>
                                <td>******</td>
                                <td><?=$value['del_status'] == 0 ? '正常' : '冻结' ?></td>
                                <td class="blue-color">
                                    <span style="margin-right: 5px;display: <?=$value['del_status'] == 1 ? 'none' : 'inline-block' ?>;cursor: pointer;" class="blue-color reset-word">重置密码</span>
                                    <span style="display: <?=$value['del_status'] == 0 ? 'none' : 'inline-block' ?>;cursor: pointer;" class="blue-color thaw">解冻</span>
                                    <span style="display: <?=$value['del_status'] == 1 ? 'none' : 'inline-block' ?>;cursor: pointer;" class="blue-color frozen">冻结</span>
                                </td>
                            </tr>
                        <?php endforeach ?>
                    </tbody>
                </table>
            </div>
            <div class="group-title">功能配置</div>
            <div class="ly-box">
        
                <div class="configuration">选择功能配置</div>
                <div class="functional">
                    <label for="index_auth" class="auth">
                        <div class="item">
                            <div class="img"><i class="iconfont">&#xe621;</i><p>酒店主页</p></div>
                            <div class="yq <?=$find['index_auth'] == 1 ? 'select' : '' ?>">
                                <i class="iconfont" style="<?=$find['index_auth'] == 1 ? 'display: none' : '' ?>">&#xe64d;</i>
                                <i class="iconfont" style="<?=$find['index_auth'] == 1 ? 'display: block' : 'display: none' ?>">&#xe64c;</i>
                                <input type="hidden" id="index_auth" name="index_auth" value="<?=$find['index_auth'] ?>">
                            </div>
                        </div>
                    </label>
                    <label for="index_auth" class="invoice_Apply">
                        <div class="item">
                            <div class="img"><i class="iconfont">&#xe638;</i><p>发票申请</p></div>
                            <div class="yq <?=$find['invoice_auth'] == 1 ? 'select' : '' ?>">
                                <i class="iconfont" style="<?=$find['invoice_auth'] == 1 ? 'display: none' : '' ?>">&#xe64d;</i>
                                <i class="iconfont" style="<?=$find['invoice_auth'] == 1 ? 'display: block' : 'display: none' ?>">&#xe64c;</i>
                                <input type="hidden" id="invoice_auth" name="invoice_auth" value="<?=$find['invoice_auth'] ?>">
                            </div>
                        </div>
                    </label>
                    <label for="index_auth" class="room">
                        <div class="item">
                            <div class="img"><i class="iconfont">&#xe716;</i><p>套房预订</p></div>
                            <div class="yq <?=$find['room_auth'] == 1 ? 'select' : '' ?>">
                                <i class="iconfont" style="<?=$find['room_auth'] == 1 ? 'display: none' : '' ?>">&#xe64d;</i>
                                <i class="iconfont" style="<?=$find['room_auth'] == 1 ? 'display: block' : 'display: none' ?>">&#xe64c;</i>
                                <input type="hidden" id="room_auth" name="room_auth" value="<?=$find['room_auth'] ?>">
                            </div>
                        </div>
                    </label>
                </div>
            </div>
            <div class="group-operate" style="background: #fff;">
                <div class="hw-container">
                    <a class="hw-btn hw-default-btn"  href="#" onclick="history.go(-1)">返回</a>
                    <button class="hw-btn">保存</button>
                </div>
            </div>
        </div>
        </form>
    </div>

	<script src="/static/lib/jquery-1.12.4.min.js"></script>
	<script type="text/javascript" src="/static/lib/My97DatePicker/WdatePicker.js"></script>
	<script type="text/javascript" src="/static/lib/jquery.form.min.js"></script>
    <script type="text/javascript" src="/static/js/common/util.js"></script>
	<script type="text/javascript" src="/static/js/common/upload.js"></script>
	<script type="text/javascript" src="/static/lib/jquery.validate.js"></script>
	<script type="text/javascript" src="/static/lib/messages_zh.js"></script>
	<script type="text/javascript" src="/static/js/common/validateExtend.js"></script>
	<script type="text/javascript" src="/static/js/common/common.js"></script>
    <script type="text/javascript" src="/static/js/PCASClass.js"></script>
    <script type="text/javascript" src="/static/lib/ueditor/ueditor.config.js"></script>
	<script type="text/javascript" src="/static/lib/ueditor/ueditor.all.min.js"></script>
    <script type="text/javascript" src="/static/lib/ueditor/addCustomizeDialog.js"></script>

    <!-- <script type="text/javascript" src="https://webapi.amap.com/maps?v=1.4.10&key=fdfdefb18594af02bbb294b624770982"></script>  -->
    <script type="text/javascript" src="/static/js/hotel/edithotel.js"></script>
    <script>



        $('.functional').on('click','.auth',function(e){
            select('.auth');
            return false;
        })
        $('.functional').on('click','.invoice_Apply',function(e){
            select('.invoice_Apply');
            return false;
        })
        $('.functional').on('click','.room',function(e){
            select('.room');
            return false;
        })
        function select(str){
            var easy = $(str).find('.yq');
            if(easy.hasClass('select')){
               easy.find('input').val(0);
               easy.find('i').eq(0).show().siblings('i').hide();
               easy.removeClass('select');
           }else {
               easy.find('input').val(1);
               easy.find('i').eq(1).show().siblings('i').hide();
               easy.addClass('select');
           }
        }
        var init = function(latitude,longitude) {
            var center = new qq.maps.LatLng( latitude,longitude);
            var map = new qq.maps.Map(document.getElementById('allmap'),{
                center: center,
                zoom: 15
            });
            //创建marker
            var marker = new qq.maps.Marker({
                position: center,
                map: map
            });
        }
        if($("#lng").val()&&$("#lat").val()){//编辑
            longitude = $("#lng").val();
            latitude = $("#lat").val();
            console.log(longitude,latitude)
   
            init(latitude,longitude);
        }
        else{//添加
            $.ajax({  
                type : "post",  //提交方式  
                url : "/Api/QQMap/location",  
                data : {}, 
                success : function(res) {
                    var res = JSON.parse(res);
                    if(res.code == '1'){
                    init(res.lat,res.long); 
                    }
                    else{
                    alert("本地地址获取失败");
                    }
                }
            })          
        }    
        function searchByStationName() {

   
            if($("#province option:selected").text()=="请选择省份"){
                $.alert("请选择省份");
                return;
            }
            if($("#city option:selected").text()=="请选择城市"){
                $.alert("请选择城市");
                return;
            }
            if($("#area option:selected").text()=="请选择地区"){
                $.alert("请选择地区");
                return;
            }
            if($(".address_detail").val()==""){
                $.alert("请填写详细地址");
                return;
            }
            var keyword =$("#province option:selected").text()+$("#city option:selected").text()+$("#area option:selected").text()+$('.address_detail').val();
            $.post("/Api/QQMap/geocoder", {address: keyword},
                function (data) {
                    data = JSON.parse(data);
                    console.log(data);
                    longitude = data.long;
                    latitude = data.lat;
                    $("#lng").val(longitude);
                    $("#lat").val(latitude);
                    init(latitude,longitude);
                }
            );

               

    }
    </script>
    <script type="text/javascript">
        // var longitude;
        // var latitude;
        // if($("#lng").val()&&$("#lat").val()){
        //     longitude = $("#lng").val()
        //     latitude = $("#lat").val()
        //     console.log(longitude,latitude)
        // }
        // else{
        //     var geolocation = new BMap.Geolocation();
        //     geolocation.getCurrentPosition(function(r){
        //     if(this.getStatus() == BMAP_STATUS_SUCCESS){
        //     var mk = new BMap.Marker(r.point);
        //     map.addOverlay(mk);
        //     map.panTo(r.point);
        //     longitude=r.point.lng;
        //     latitude=r.point.lat;
        //     }
        //     else {

        //     }        
        //     });
        // }



        // var map = new BMap.Map("allmap");

    

        // map.enableScrollWheelZoom();

        // var point = new BMap.Point(longitude, latitude);

        // map.centerAndZoom(point, 13);

    

        // var marker = new BMap.Marker(point);

        // map.addOverlay(marker);

    


        // map.addEventListener("click",

        // function (e) {

        //     document.getElementById("lng").value = e.point.lng;

        //     document.getElementById("lat").value = e.point.lat;

        // });

        // var traffic = new BMap.TrafficLayer();

        // map.addTileLayer(traffic);

        // function iploac(result) {

        //     var cityName = result.name;

        // }

        // var myCity = new BMap.LocalCity();

        // myCity.get(iploac);

        // function sear(result) {

        //     var local = new BMap.LocalSearch(map, {

        //         renderOptions: {

        //             map: map

        //         }

        //     });

        //     local.search(result);

        // }

    

        // var localSearch = new BMap.LocalSearch(map);

        // localSearch.enableAutoViewport(); //允许自动调节窗体大小

    

        // function searchByStationName() {

        //     map.clearOverlays();//清空原来的标注
        //     if($("#province option:selected").text()=="请选择省份"){
        //         $.alert("请选择省份");
        //         return;
        //     }
        //     if($("#city option:selected").text()=="请选择城市"){
        //         $.alert("请选择城市");
        //         return;
        //     }
        //     if($("#area option:selected").text()=="请选择地区"){
        //         $.alert("请选择地区");
        //         return;
        //     }
        //     if($(".address_detail").val()==""){
        //         $.alert("请填写详细地址");
        //         return;
        //     }
        //     var keyword =$("#province option:selected").text()+$("#city option:selected").text()+$("#area option:selected").text()+$('.address_detail').val();
        //     console.log(keyword,3212112121);
        //     localSearch.setSearchCompleteCallback(function (searchResult) {

        //     if(searchResult.Br.length==0){
        //         $.alert("没有找到，请重新搜索")
        //         return
        //     }
        //         var poi = searchResult.getPoi(0);
        //         $("#lng").val(poi.point.lng)
        //         $("#lat").val(poi.point.lat)
        //         map.centerAndZoom(poi.point, 13);

        //         var marker11 = new BMap.Marker(new BMap.Point(poi.point.lng, poi.point.lat));  // 创建标注，为要查询的地方对应的经纬度

        //         map.addOverlay(marker11);


    
        //         });

        //         localSearch.search(keyword);

        //     }


    var provinceval = '<?=!empty($find['province'])?$find['province']:'请选择省份'?>';
    var cityval = '<?=!empty($find['city'])?$find['city']:'请选择城市'?>';
    var area = '<?=!empty($find['area'])?$find['area']:'请选择地区'?>';
    // 省市区联动
   
    // var provinceval = '请选择省份';
    // var cityval = '请选择城市';
    // var area = '请选择地区';
    new PCAS("province","city",'area',provinceval,cityval,area);

    // searchByStationName();
    </script>
</body>
</html>